/*
 * Copyright 2015 CPE Lyon - IRC 2013/2016 - Cours de programmation réseau - Groupe H
 *
 * This file is part of BOTT.
 *
 * BOTT is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 *
 * BOTT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with BOTT. If not, see http://www.gnu.org/licenses/.
 */

/*
 * Fonctions dédiées au serveur de messagerie.
 */

#ifndef TRAITEMENTS_SERVEUR_H
#define TRAITEMENTS_SERVEUR_H

/* Traitement d'un message reçu */
void *messageTreatment(void* transmitData);

/* Traiter les demandes de connexion */
bimp_msg treatConnect(bimp_msg receivedData, client *allClients, struct sockaddr_in clientAddr, int *idUser);

/* Traiter les demandes d'accès à un salon */
bimp_msg treatJoin(bimp_msg receivedData, client *allClients, chat *allChats);

/* Traiter un message envoyé par un client sur un salon */
bimp_msg treatSay(bimp_msg receivedData, client *allClients, chat *allChats, int socketDesc);

/* Traiter les demandes de déconnexion à un salon */
bimp_msg treatLeave(bimp_msg receivedData, client *allClients, chat *allChats);

/* Traiter les demandes de déconnexion */
bimp_msg treatDisconnect(bimp_msg receivedData, client *allClients, chat *allChats);

/* Traiter les demandes de maintien de la connexion */
bimp_msg treatAlive(int idUser);

/* Traiter les demandes de changement de pseudonyme */
bimp_msg treatNick(bimp_msg receivedData, client *allClients);

/* Obtenir le pseudonyme d'un utilisateur depuis son ID */
bimp_msg treatGetNick(bimp_msg receivedData, client *allClients);

#endif